package org.example.service.impl;

import org.example.dao.AttendanceDao;
import org.example.model.Attendance;
import org.example.service.AttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

@Service
public class AttendanceServiceImpl implements AttendanceService {

    @Autowired
    private AttendanceDao attendanceDao;

    @Override
    public Attendance findAttendanceById(int attendanceId) {
        return attendanceDao.findAttendanceById(attendanceId);
    }

    @Override
    public List<Attendance> queryAllAttendance() {
        return attendanceDao.queryAllAttendance();
    }

    @Override
    public boolean addAttendance(Attendance attendance) {
        return attendanceDao.addAttendance(attendance) > 0;
    }

    @Override
    public boolean updateAttendance(Attendance attendance) {
        return attendanceDao.updateAttendance(attendance) > 0;
    }

    @Override
    public boolean deleteAttendance(int attendanceId) {
        return attendanceDao.deleteAttendance(attendanceId) > 0;
    }

    @Override
    public boolean deleteAttendances(List<Integer> attendanceIds) {
        return attendanceDao.deleteAttendances(attendanceIds) > 0;
    }

    @Override
    public List<Attendance> queryAttendanceByTeacherId(int teacherId) {
        return attendanceDao.queryAttendanceByTeacherId(teacherId);
    }

    @Override
    public List<Attendance> queryAttendanceByDateRange(Map<String, Object> dateRange) {
        return attendanceDao.queryAttendanceByDateRange(dateRange);
    }

    @Override
    public List<Attendance> queryAttendanceByStatus(String status) {
        return attendanceDao.queryAttendanceByStatus(status);
    }
}